package com.zoffy.oj_backend.judge.codesandbox.impl.ExampleCodeSandbox.codeExcuter;

import com.zoffy.oj_backend.judge.codesandbox.model.ExecuteMessage;

import java.io.File;
import java.util.List;

public class PythonCodeExecutor extends AbstractCodeExecutor{
    private static final String GLOBAL_PYTHON_CLASS_NAME = "main.py";
    private static final String JAVA_RUNNING_COMMAND="python %s"+File.separator+"main.py %s";
    @Override
    public File saveCode2File(String code) {
        return saveCode2File(code,GLOBAL_PYTHON_CLASS_NAME);
    }

    @Override
    public ExecuteMessage compileCode(File codeFile) {
        ExecuteMessage message=new ExecuteMessage();
        message.setExitCode(0);
        return message;
    }

    @Override
    public List<ExecuteMessage> runCodeFile(File file, List<String> inputList) {
        return runCodeFile(file,inputList,JAVA_RUNNING_COMMAND);
    }
}
